package com.jf.identity.service.impl;

import com.jf.identity.entity.DataProgress;
import com.jf.identity.entity.ExamBaseParamValidator;
import com.jf.identity.mongo.DataProgressDao;
import com.jf.identity.service.DataProgressService;
import com.jf.identity.util.UUIDUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class DataProgressServiceImpl implements DataProgressService {

    @Resource
    private DataProgressDao dataProgressDao;
    @Resource
    private ExamBaseParamValidator examBaseParamValidator;

    @Override
    public boolean insertDataProgress(DataProgress dataProgress) {
        examBaseParamValidator.validateExamPlan(dataProgress.getExamPlan());
        dataProgress.setUid(UUIDUtil.generateUUID());
        dataProgress.setTimestamp(new Date());
        dataProgressDao.insertDataProgress(dataProgress);
        return true;
    }
}
